﻿@using OA.Models.ViewModels

@(
    Html.Kendo().Grid<ApplicationFormViewModel>()
    .Name("grid")
    .HtmlAttributes(new { style = "height:99%" })
    .Columns(columns =>
    {
        columns.Bound(d => d.Id);
        columns.Bound(d => d.ApplicationType);
        columns.Bound(d => d.Status);
        columns.Bound(d => d.ModificationDate);
        columns.Template(d => d.Id).ClientTemplate
        (
            "# if(Status == 0){ #" +
                "<button class='k-button' onclick='Edit(\"#=Id#\", \"#=ApplicationType#\")'>" +
                    "编辑" +
                "</button>" +
            "# }#"
        );
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(10)
        .Read(read => read.Action("Read", "ApplicationForm"))
    )
)

<script>
    function Edit(id, type) {
        location.href = "/ApplicationForm/Detail?type=" + type + "&Id=" + id;
    }
</script>